import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ViewUI from 'view-design'
// import 'view-design/dist/styles/iview.css'
import VueLazyload from 'vue-lazyload'
import VueApexCharts from 'vue-apexcharts'
import { setStore, getStore, removeStore } from '@/libs/storage'
import '@babel/polyfill'

Vue.config.productionTip = false

Vue.use(ViewUI);
Vue.use(VueLazyload, {
  error: require('./assets/img-error.png'),
  loading: require('./assets/loading.gif')
})
Vue.use(VueApexCharts);
Vue.component('apexchart', VueApexCharts);

// 挂载全局使用的方法
Vue.prototype.setStore = setStore;
Vue.prototype.getStore = getStore;
Vue.prototype.removeStore = removeStore;

router.beforeEach((to, from, next) => {
  ViewUI.LoadingBar.start();
  next();
});

router.afterEach((to) => {
  ViewUI.LoadingBar.finish();
  window.scrollTo(0, 0);
});

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
